<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Form Layouts</title>
    <!--file upload-->
    <link rel="stylesheet" type="text/css" href="/public/css/bootstrap-fileupload.min.css" />
    <!--dropzone css-->
    <link href="/public/js/dropzone/css/dropzone_1.css" rel="stylesheet"/>

    <!--icheck-->
    <link href="/public/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
    <link href="/public/js/iCheck/skins/flat/green.css" rel="stylesheet">

    <link href="/public/js/iCheck/skins/flat/blue.css" rel="stylesheet">
    <link href="/public/js/select2/dist/css/select2.min.css" rel="stylesheet">

    <?php $this->load->view('library/header');?>
    <link href="/public/css/jquery.stepy.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/public/js/bootstrap-datepicker/css/datepicker-custom.css" />
    <style type="text/css">
        .stepy-titles li {
            width: 10%;
        }
        .icheck .single-row .radio {margin-right: 30px;}
    </style>
</head>

<body class="sticky-header">

<section>
    <?php $this->load->view('library/left');?>

    <!-- main content start-->
    <div class="main-content" >

        <?php $this->load->view('library/top');?>

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                打板
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class="active"> Forms Layouts </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <section class="wrapper">
            <!-- page start-->

            <div class="row">
                <div class="col-lg-12">
                    <div class="widget-container">
                        <div class="stepy-tab">
                            <ul id="default-titles" class="stepy-titles clearfix">
                                <li class=""><div>发起定制</div><span>Step 1</span></li>
                                <li ><div>打板</div><span>Step 2</span></li>
                                <li class="current-step"><div>到样检测</div><span>Step 3</span></li>
                                <li class=""><div>采购大货</div><span>Step 4</span></li>
                                <li class=""><div>跟单</div><span>Step 5</span></li>
                                <li class=""><div>完成</div><span>Step 6</span></li>
                            </ul>
                        </div>
                    </div>
                    <section class="panel">
                        <div class="panel-body">
                            <form class="cmxform form-horizontal adminex-form" id="commentForm" enctype="multipart/form-data" method="post" action="">
                                <div class="form-group ">
                                    <label for="curl" class="control-label col-lg-2">产品货号</label>
                                    <div class="col-lg-4" style="    margin-top: 7px;">
                                        <?php echo $custom['goods_sn'];?>
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <label for="curl" class="control-label col-lg-2">样品图片</label>
                                    <div class="col-lg-6">
                                        <div class="dropzone"></div>
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <label for="curl" class="control-label col-lg-2">检测结果</label>
                                    <div class="col-lg-9 icheck">
                                        <div class="flat-green single-row">
                                            <div class="radio ">
                                                <input tabindex="3" type="radio"  name="custom_state" value="4">
                                                <label>合格</label>
                                            </div>
                                        </div>
                                        <div class="flat-green single-row">
                                            <div class="radio ">
                                                <input tabindex="3" type="radio"  name="custom_state" value="5">
                                                <label>重新打板</label>
                                            </div>
                                        </div>
                                        <div class="flat-green single-row">
                                            <div class="radio ">
                                                <input tabindex="3" type="radio"  name="custom_state" value="6">
                                                <label>结束</label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <label for="curl" class="control-label col-lg-2">原因</label>
                                    <div class="col-lg-6">
                                        <textarea rows="6" name="remark" class="form-control"></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 col-sm-2 control-label"></label>
                                    <div class="col-lg-10">
                                        <button type="submit" class="btn btn-primary">提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </section>
                </div>
            </div>
            <!-- page end-->
        </section>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            2014 &copy; AdminEx by
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>
<?php $this->load->view('library/footer');?>

<script type="text/javascript" src="/public/js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>


<script src="/public/js/iCheck/jquery.icheck.js"></script>
<script src="/public/js/icheck-init.js"></script>

<!--dropzone-->
<script src="/public/js/dropzone.js"></script>

<script src="/public/js/express-art-template-master/template-web.js"></script>
<!--file upload-->
<script type="text/javascript" src="/public/js/bootstrap-fileupload.min.js"></script>
<script type="text/javascript" src="/public/js/select2/dist/js/select2.min.js"></script>
<script type="text/javascript">

    Dropzone.autoDiscover = false;
    var add_file = [];
    $(".dropzone").dropzone({
        url: "http://ci.test/Custom/add/custom_id/1/step/4",
        autoProcessQueue: false,
        addRemoveLinks:true,
        init: function() {
            this.on("addedfile", function(file) {
                add_file.push(file);
            });
        }
    });


    $(function () {



        $('.date-picker').datepicker({
            format: "yyyy-mm-dd"
        });

        $('.js-data-ajax').select2({
            ajax: {
                url: '<?php echo base_url('Custom/get_supp/supp_name/');?>',
                dataType: 'json',
                processResults: function (data) {
                    return {
                        results: data
                    };
                }
            }
        });

        $('.get-sku').on('click', function () {

            var goods_sn = $('input[name="goods_sn"]').val();

            $.get('<?php echo base_url('Custom/getsku/goods_sn/'); ?>'+goods_sn, function (data) {
                console.log(data);

                var html = '';
                var sku_data = data.data;
                for (x in sku_data) {
                    html += '<div class="minimal-blue single-row">' +
                        '<div class="checkbox ">' +
                        '<input name="sku[]" value="' + sku_data[x].sku_id + '" type="checkbox" >' +
                        '<label>' + sku_data[x].color + ' / ' + sku_data[x].size + '</label></div></div>'
                }

                $('.sku-post').html(html);
                $('.icheck input').iCheck({
                    checkboxClass: 'icheckbox_flat-blue',
                    radioClass: 'iradio_flat-blue'
                });
            },'json');
        });


        $('#commentForm').submit(function () {

            var data = new FormData(this);

            for (x in add_file) {
                data.append('files'+x, add_file[x]);
            }

            $('button[type="submit"]').attr('disabled','disabled').addClass('btn-submit-disabled').html('正在提交，请稍等...');

            $.ajax({
                url: self.location.href,
                type: 'POST',
                cache: false,
                dataType:'json',
                data: data,
                success: function(data) {
                    if (data.status != 'success') {
                        swal({
                            title:   data.info,
                            text: '2秒后关闭',
                            type: data.status,
                            allowOutsideClick: false,
                            timer: 1500,
                            showConfirmButton: false
                        });
                    } else {
                        swal({
                            title: data.info,
                            text: '2秒后关闭',
                            type: data.status,
                            allowOutsideClick: false,
                            timer: 1500,
                            showConfirmButton: false
                        }).then(function(isConfirm) {
                            window.onbeforeunload = '';
                            window.location.href = '<?php echo base_url('Custom/index/step/2');?>';
                        });
                    }
                    $('button[type="submit"]').attr("disabled",false).removeClass('btn-submit-disabled').html('提交信息');
                },
                processData: false,
                contentType: false
            });

            setTimeout(function() {
                $('button[type="submit"]').attr("disabled",false).removeClass('btn-submit-disabled').html('提交信息');
            }, '3000');

            return false;
        });
    });
</script>

<!--common scripts for all pages-->
<script src="/public/js/scripts.js"></script>

</body>
</html>
